using System;

namespace Tarkin.InfrastructureLibrary.Core.Basic
{
    /// <summary>
    /// The NamedElement class is the implementation of NamedElement abstract class as defined by 
    /// section 10.1.3 of the Unified Modeling Language: Infrastructure specfication (version 2.1.1,
    /// dated 07-02-06).
    /// </summary>
    /// <remarks>Tarkin classes are NOT thread-safe.</remarks>
    public abstract class NamedElement : Element
    {

#region Private Members

        /// <summary>
        /// The name of the element.
        /// </summary>
        private string name = string.Empty;

#endregion

        
#region Constructors

        /// <summary>
        /// Default constructor.
        /// </summary>
        public NamedElement ()
        { }
        
        /// <summary>
        /// Overloaded constructor.
        /// </summary>
        /// <param name="name">The name of the element.</param>
        public NamedElement ( string name )
        {
            Name = name;
        }

#endregion


#region Public Properties

        /// <summary>
        /// The name of the element.
        /// </summary>
        public string Name
        {
            get
            {
                if ( name == null )
                {
                    name = string.Empty;
                }

                return name;
            }

            set
            {
                name = value;
            }
        }

#endregion

    }
}
